package jlib.component.scroll.skin
{
	import flash.display.Graphics;
	import flash.display.LineScaleMode;
	import flash.geom.Point;

	internal final class Drawer
	{
		static public function box($graphics:Graphics, $color:uint, $lineColor:uint, $width:Number=0, $height:Number=0): void {
			$graphics.beginFill($color);
			$graphics.lineStyle(1,$lineColor,1,false,LineScaleMode.NORMAL);
			$graphics.drawRect(0,0,$width,$height);
			$graphics.endFill();
		}
		
		static public function outline($graphics:Graphics, $width:Number=0, $height:Number=0): void {
			$graphics.lineStyle(1,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(2,2);
			$graphics.lineTo($width-2,2);
			$graphics.moveTo(2,2);
			$graphics.lineTo(2,$height-2);
		}
		
		static public function centerVLines($graphics:Graphics): void {
			$graphics.lineStyle(2,0x969696,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-2,-4);
			$graphics.lineTo(2,-4);
			$graphics.lineStyle(2,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-2,-3);
			$graphics.lineTo(2,-3);
			
			$graphics.lineStyle(2,0x969696,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-2,0);
			$graphics.lineTo(2,0);
			$graphics.lineStyle(2,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-2,1);
			$graphics.lineTo(2,1);
			
			$graphics.lineStyle(2,0x969696,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-2,4);
			$graphics.lineTo(2,4);
			$graphics.lineStyle(2,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-2,5);
			$graphics.lineTo(2,5);
		}
		
		static public function centerHLines($graphics:Graphics): void {
			$graphics.lineStyle(2,0x969696,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-4,-2);
			$graphics.lineTo(-4,2);
			$graphics.lineStyle(2,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(-3,-2);
			$graphics.lineTo(-3,2);
			
			$graphics.lineStyle(2,0x969696,1,false,LineScaleMode.NONE);
			$graphics.moveTo(0,-2);
			$graphics.lineTo(0, 2);
			$graphics.lineStyle(2,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(1, -2);
			$graphics.lineTo(1, 2);
			
			$graphics.lineStyle(2,0x969696,1,false,LineScaleMode.NONE);
			$graphics.moveTo(4, -2);
			$graphics.lineTo(4, 2);
			$graphics.lineStyle(2,0xffffff,1,false,LineScaleMode.NONE);
			$graphics.moveTo(5, -2);
			$graphics.lineTo(5, 2);
		}
		
		static public function triangle($graphics:Graphics, $cx:Number, $cy:Number, $radius:Number): void {
			var point0:Point = Point.polar($radius,Math.PI*2/3*0);
			var point1:Point = Point.polar($radius,Math.PI*2/3*1);
			var point2:Point = Point.polar($radius,Math.PI*2/3*2);
			
			point0.x += $cx;
			point0.y += $cy;
			point1.x += $cx;
			point1.y += $cy;
			point2.x += $cx;
			point2.y += $cy;
			
			$graphics.moveTo(point0.x, point0.y);
			$graphics.lineTo(point1.x, point1.y);
			$graphics.lineTo(point2.x, point2.y);
			$graphics.lineTo(point0.x, point0.y);
		}	
			
	}
}